<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Home extends wsFrontend
{

    public function __construct()
    {
        parent::__construct();
        $this->db->cache_set_path(dirname($this->db->cachedir) . '/home/');
    }

    public function index()
    {
        $data = array();
        $this->tpl->meta ['title'] = $this->metadata->get_metadata('_home_index_title', 'home');
        $this->tpl->meta ['description'] = $this->metadata->get_metadata('_home_index_description', 'home');
        $this->tpl->meta ['keywords'] = $this->metadata->get_metadata('_home_index_keywords', 'home');
        $this->load->model('wallpaper_model');
        $data['featured'] = $this->wallpaper_model->getWallpapers(array('per_page' => 5, 'featured' => true, 'bypath' => false));

        $data['wallpapers'] = $this->wallpaper_model->getWallpapers(array('per_page' => $this->config->item('items_per_page'), 'bypath' => false));
        $this->tpl->contents [] = $this->tpl->fetch('contents/home', $data);
        $this->tpl->render('layouts/home');
    }
}
